/**
 * @file		CMDinterpreter.h
 * @brief		Command Interpreter
 * @note		None
 * @attention	None
 * 
 * <B><I>ALL RIGHTS RESERVED, COPYRIGHT&copy; SOCIONEXT INCORPORATED 2016</I></B>
 */

/** @weakgroup cmd_interpreter_overview
@{
	Command Interpreter base function.<br>
	<br>
	It analyzes the issued command, to perform the corresponding function.<br>
	Refer to @ref command "here" for "Command".
@}*//* --- end of cmd_interpreter_overview */

#ifndef _CMDINTERPRETER_H_
#define _CMDINTERPRETER_H_

#include "FreeRTOS.h"
#include "event_groups.h"

/** @weakgroup cmd_interpreter_definition
@{*/

/** bit positon of nofication for event flag */
typedef enum {
	NFY_UART_SEND = 0,				/**< UART send */
	NFY_UART_RECEIVE,				/**< UART receive */
	NFY_SPI_SEND,					/**< SPI send */
	NFY_SPI_RECEIVE,				/**< SPI receive */
	NFY_I2C_SEND,					/**< I2C send */
	NFY_I2C_RECEIVE,				/**< I2C receive */
	NFY_ADC,						/**< ADC */
	NFY_TEMPERATURE,				/**< Temperature Sensor */
	NFY_SEND_RESPONSE,				/**< Send response to Linux */
	NFY_MAX
} E_NOFITICATION_FLAG_BIT_POS;

/** Event flag to control notification */
extern EventGroupHandle_t xNotifyEventFlag;	/**< Nortification event flag */

/* @} */	// cmd_interpreter_definition group

/** @weakgroup cmd_interpreter_func
@{*/

/**
Interprete one command indicated by start address
@param [in]	cmd		top address of command<br>
	If need of response (ex. READ
### DELETE_SECURE
		and CRYPTO
### DELETE_SECURE
	),<br>
	(1) cmd[0] : be added 0x01000000 <br>
	(2) cmd[8] : return-value will be written.<br>
@retval   0 : success
@retval  -1 : failure. invalid command
@retval  -2 : failure. invalid 1st parameter
@retval -99 : success. END command
@remarks This function will be used by IPCU command module.
*/
int iInterpretCommand(unsigned *cmd);

/* @} */	// cmd_interpreter_func group

#endif	// _CMDINTERPRETER_H_
